<!--********************************************************************
* Copyright© 2000 - 2025 SuperMap Software Co.Ltd. All rights reserved.
*********************************************************************-->
<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title data-i18n="resources.title_tiledMapLayerNoProj"></title>
    <script type="text/javascript" src="../js/include-web.js"></script>
    <script type="text/javascript" src="../../dist/ol/include-ol.js"></script>
  </head>
  <body style="margin: 0; overflow: hidden; background: #fff; width: 100%; height: 100%; position: absolute; top: 0">
    <div id="map" style="width: 100%; height: 100%"></div>
    <script type="text/javascript">
      var map,
        url =
          (window.isLocal ? window.server : 'https://iserver.supermap.io') +
          '/iserver/services/map-changchun/rest/maps/长春市区图';
      // 方式一：1.调用 ol.supermap.initMap，根据 SuperMap iServer 地图服务的地图信息，创建地图和底图
      ol.supermap.initMap(url, {
        mapOptions: {
            // ol v7版本用法为ol.control.defaults.defaults； v6版本以下用法为ol.control.defaults
            controls: ol.control.defaults.defaults({attributionOptions: {collapsed: false}})
              .extend([new ol.supermap.control.Logo({ link: "https://iclient.supermap.io" })])
        }
      });
      /* 方式二：1.调用 ol.supermap.MapService，获取 SuperMap iServer 地图服务的地图信息
                2.调用 ol.supermap.viewOptionsFromMapJSON 获取地图视图参数
                3.调用 ol.Map 创建地图
                4.调用 ol.layer.Tile 与 ol.source.TileSuperMapRest 创建底图
      new ol.supermap.MapService(url).getMapInfo().then(function (serviceResult) {
          var mapObj = serviceResult.result;
          var map = new ol.Map({
              target: 'map',
              // ol v7版本用法为ol.control.defaults.defaults； v6版本以下用法为ol.control.defaults
              controls: ol.control.defaults.defaults({attributionOptions: {collapsed: false}})
                  .extend([new ol.supermap.control.Logo({ link: "https://iclient.supermap.io" })]),
              view: new ol.View(ol.supermap.viewOptionsFromMapJSON(mapObj))
          });
          var layer = new ol.layer.Tile({
              source: new ol.source.TileSuperMapRest(ol.source.TileSuperMapRest.optionsFromMapJSON(url, mapObj))
          });
          map.addLayer(layer);
          map.addControl(new ol.supermap.control.ScaleLine());
      });
      */
    </script>
  </body>
</html>
